package com.dropgame.tools;

import aurelienribon.tweenengine.TweenAccessor;

public class ImageButtonAccessor implements TweenAccessor<ImageButton>{

	public static final int POSITION_X = 1;
	public static final int POSITION_Y = 2;
	public static final int POSITION_XY = 3;
	
	
	@Override
	public int getValues(ImageButton target, int tweenType, float[] returnValues) {
		switch(tweenType){
		case POSITION_X: returnValues[0] = (int) target.getxPos(); return 1;
		case POSITION_Y: returnValues[0] = (int) target.getyPos(); return 1;
		case POSITION_XY:
			returnValues[0] = (int) target.getxPos();
			returnValues[1] = (int) target.getyPos();
			return 2;
		default: assert false; return -1;
		}
		
	}

	@Override
	public void setValues(ImageButton target, int tweenType, float[] newValue) {
		switch(tweenType){
		case POSITION_X: target.setxPos((int) newValue[0]); break;
		case POSITION_Y: target.setyPos((int) newValue[0]); break;
		case POSITION_XY:
			target.setxPos((int) newValue[0]);
			target.setyPos((int) newValue[1]);
			break;
		default: assert false; break;
		}
		
	}

}
